public class demo40 {
    //不同路径II（动态规划）
    class Solution {
        public int uniquePathsWithObstacles(int[][] ob) {
            //1.建表
            int len1 = ob.length,len2 = ob[0].length;
            int[][] dp = new int[len1+1][len2+1];
            //2.初始化
            if(ob[len1-1][len2-1] == 1) return 0;

            dp[0][1] = 1;
            dp[1][1] = 0;
            //3.填表
            for(int i = 0;i<len1;i++)
            {
                for(int j = 0;j<len2;j++)
                {
                    if(ob[i][j]==0)
                    {
                        dp[i+1][j+1] = dp[i][j+1]+dp[i+1][j];
                    }
                }
            }
            //4.返回值
            return dp[len1][len2];
        }
    }
}
